Learn R Programming

bnlearn (version 4.9.1)

utilities for whitelists and blacklists: Get or create whitelists and blacklists

Description

Extract whitelists and blacklists from an object of class bn, or create them for use in structure learning.

Usage

whitelist(x)
blacklist(x)

ordering2blacklist(nodes) tiers2blacklist(tiers) set2blacklist(set)

Value

whitelist() and blacklist() return a matrix of character string with two columns, named from and to, if whitelist or a blacklist have been used to learn the bn object passed as their argument.

ordering2blacklist(), tiers2blacklist() and

set2blacklist() return a sanitized blacklist (a two-column matrix, whose columns are labeled from and to).

Arguments

x

an object of class bn.

nodes,set

a vector of character strings, the labels of the nodes.

tiers

a vector of character strings or a list, see below.

Author

Marco Scutari

Details

ordering2blacklist() takes a vector of character strings (the labels of the nodes), which specifies a complete node ordering. An object of class bn or bn.fit; in that case, the node ordering is derived by the graph. In both cases, the blacklist returned by ordering2blacklist() contains all the possible arcs that violate the specified node ordering.

tiers2blacklist() takes (again) a vector of character strings (the labels of the nodes), which specifies a complete node ordering, or a list of character vectors, which specifies a partial node ordering. In the latter case, all arcs going from a node in a particular element of the list (sometimes known as tier) to a node in one of the previous elements are blacklisted. Arcs between nodes in the same element are not blacklisted.

set2blacklist() creates a blacklist containing all the arcs between any two of the nodes whose labels are passed as the argument set.

Examples

Run this code
tiers2blacklist(list(LETTERS[1:3], LETTERS[4:6]))
set2blacklist(LETTERS[1:3])
ordering2blacklist(LETTERS[1:6])

Run the code above in your browser using DataLab